import Vue from 'vue'
import Router from 'vue-router'
import Leaderboard from '@/components/Leaderboard'
import Total from '@/components/total'
import Home from '@/components/Home'
import Mine from '@/components/Mine'
import Cutting from '@/components/Cutting'
import GameType from '@/components/GameType'
import List from '@/components/List'
import Hot from '@/components/Hot'
import New from '@/components/New'
import Detail from '@/components/Detail'
import About from '@/components/About'
import Gift from '@/components/Gift'
import Register from '@/components/register'
import Login from '@/components/login'
import GameHistory from '@/components/GameHistory'
import Collection from '@/components/Collection'
import GamePresent from '@/components/GamePresent'

Vue.use(Router)

export default new Router({
  routes: [

    {
        path: '/leaderboard',
        name: 'Leaderboard',
        component: Leaderboard,
        children:[
        	{
        		path:'total',
        		name:'total',
        		component:Total
        	},
          {
            path:'cutting',
            name:'cutting',
            component:Cutting
          }
        ]
  	},
    {
      path:'/',
      name: 'Home',
      component: Home
    },
    {
      path: '/mine',
      name: 'Mine',
      component: Mine,
      children: [
        {
          path: 'gameHistory',
          name: 'GameHistory',
          component: GameHistory
        },
        {
          path: 'collection',
          name: 'Collection',
          component: Collection
        },
        {
          path: 'gamePresent',
          name: 'GamePresent',
          component: GamePresent
        }
      ]
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/register',
      name: 'Register',
      component: Register
    },
    {
      path:'/gameType',
      name:'GameType',
      component:GameType,
    },
    {
        path: '/List/:id',
        name: 'list',
        component: List,
        children:[
          {
            path:'hot',
            name:'hot',
            component:Hot
          },
          {
            path:'new',
            name:'new',
            component:New
          },

        ]
    },
    {
      path:'/detail',
      name:'detail',
      component:Detail,
      children:[
        {
          path:'about',
          name:'About',
          component:About
        },
        {
          path:'gift',
          name:'Gift',
          component:Gift
        }
      ]
    },

  ],
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return { x: 0, y: 0 }
    }
  }
})
